#include "ai_service.h"
#include "iremote_object.h"
#include "system_ability_definition.h"
#include "ai_service_log.h"
#include "ai_service_errors.h"
#include "ai_service_impl.h"

using namespace OHOS::HiviewDFX;

namespace OHOS {
namespace AIS {
namespace {
    constexpr HiLogLabel LABEL = {LOG_CORE, AIS_LOG_DOMAIN, "AIService"};
}
REGISTER_SYSTEM_ABILITY_BY_ID(AIService, AI_SERVICE_ID, true);

AIService::AIService(int32_t systemAbilityId, bool runOnCreate)
    : SystemAbility(systemAbilityId, runOnCreate)
{

}

AIService::~AIService()
{
}

void AIService::OnStart()
{
    if (!SystemAbility::Publish(this))
    {
        AIS_HILOGE("publish DeviceSecurityManagerService sa failed code:%{public}d , %{public}s", errno, strerror(errno));
        return;
    }
    AIS_HILOGI("OnStart success");
}

void AIService::OnStop()
{
    AIS_HILOGI("OnStop success");
}

int32_t AIService::Init(std::string& modelPath, int32_t* modelId)
{
    return AIServiceImpl::GetInstance().Init(modelPath, modelId);
}

int32_t AIService::Process(const int32_t modelId, PicDesc& picDesc, std::string& picData, InferResult& result)
{
    return AIServiceImpl::GetInstance().Process(modelId, picDesc, picData, result);
}

int32_t AIService::DeInit()
{
    return AIServiceImpl::GetInstance().DeInit();
}


} // namespace AIS
} // namespace OHOS